package com.it.park.controller.expose;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.it.park.client.service.OperationLogService;
import com.it.park.constant.Constant;
import com.it.park.model.OperationLog;

@Controller
@RequestMapping("/operationLog")
public class OperationLogController {
	private String rootPath=Constant.EXPOSE_PATH;
	@Autowired
	private OperationLogService operationLogService;
	
	@RequestMapping("listRows")
	@ResponseBody
	public Map<String,Object> listRows(HttpServletRequest request){
			List<OperationLog> list = operationLogService.list();
			int count = list.size();
			Map<String,Object> map  =new HashMap<String, Object>();
			map.put("total", count);
			map.put("rows", list);
			return map;
	}
	
	@RequestMapping("list")
	public String list(HttpServletRequest request){
			return rootPath+"operationLog/operationLogList";
	}
}
